package com.zzr.image.contrast.utils;

import ws.schild.jave.*;

import java.io.File;

/**
 * @author: xiaomi
 * @date: 2021/8/20
 * @description: 判断一个文件是音频还是视频
 */
public class VideoTypeUtil {
    public static void main(String[] args) throws EncoderException {
        String path = "D:\\Tool\\VideoTrans\\ffmpeg-4.1.3-win64-static\\bin\\C0C314FB2DC9A9B9CE64AC73ACD1CE90new.mp4";
        File file = new File(path);
        MultimediaObject media = new MultimediaObject(file);
        MultimediaInfo info = media.getInfo();
        AudioInfo audio = info.getAudio();
        //如果木有视频流，就会得到 null
        VideoInfo video = info.getVideo();
        String format = info.getFormat();
        System.out.println(format);
    }
}
